package br.com.mucceli.politicapopular.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author mucceli
 */
@Entity
@Table(name = "OPCOES_ENQUETE")
@NamedQueries({
    @NamedQuery(name = "OpcoesEnquete.findAll", query = "SELECT o FROM OpcoesEnquete o"),
    @NamedQuery(name = "OpcoesEnquete.findByIdOpcoesEnquete", query = "SELECT o FROM OpcoesEnquete o WHERE o.idOpcoesEnquete = :idOpcoesEnquete"),
    @NamedQuery(name = "OpcoesEnquete.findByNumeroVotos", query = "SELECT o FROM OpcoesEnquete o WHERE o.numeroVotos = :numeroVotos")})
public class OpcoesEnquete implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_OPCOES_ENQUETE")
    private Integer idOpcoesEnquete;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Size(min = 1, max = 65535)
    @Column(name = "DESCRICAO")
    private String descricao;
    @Column(name = "NUMERO_VOTOS")
    private Integer numeroVotos;
    @JoinColumn(name = "FK_ENQUETE", referencedColumnName = "ID_ENQUETE")
    @ManyToOne(optional = false)
    private Enquete fkEnquete;

    public OpcoesEnquete() {
    }

    public OpcoesEnquete(Integer idOpcoesEnquete) {
        this.idOpcoesEnquete = idOpcoesEnquete;
    }

    public OpcoesEnquete(Integer idOpcoesEnquete, String descricao) {
        this.idOpcoesEnquete = idOpcoesEnquete;
        this.descricao = descricao;
    }

    public Integer getIdOpcoesEnquete() {
        return idOpcoesEnquete;
    }

    public void setIdOpcoesEnquete(Integer idOpcoesEnquete) {
        this.idOpcoesEnquete = idOpcoesEnquete;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public Integer getNumeroVotos() {
        return numeroVotos;
    }

    public void setNumeroVotos(Integer numeroVotos) {
        this.numeroVotos = numeroVotos;
    }

    public Enquete getFkEnquete() {
        return fkEnquete;
    }

    public void setFkEnquete(Enquete fkEnquete) {
        this.fkEnquete = fkEnquete;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idOpcoesEnquete != null ? idOpcoesEnquete.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OpcoesEnquete)) {
            return false;
        }
        OpcoesEnquete other = (OpcoesEnquete) object;
        if ((this.idOpcoesEnquete == null && other.idOpcoesEnquete != null) || (this.idOpcoesEnquete != null && !this.idOpcoesEnquete.equals(other.idOpcoesEnquete))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.mycompany.mavenproject1.OpcoesEnquete[ idOpcoesEnquete=" + idOpcoesEnquete + " ]";
    }
    
}
